#ifndef TILE_H
#define TILE_H

#include <list>
#include <vector>

#include "defines.h"
#include "mapobj.h"

class Item;
class Monster;

class Tile : public MapObject
{
public:
	Tile( int x, int y, std::string name = "floor", char symbol = '.', bool passable = true );
	virtual ~Tile();
	DECLARE_INSTANCE;
	void setTile( map * m, int x, int y, std::string name = "floor",
		char symbol = '.', bool passable = true );
	virtual bool move( int direction = 0 ) override;
	virtual void draw() override;
	virtual int setMapPos( map * m, int x, int y ) override;
	void convertToWall();
	bool isWall();
	void convertToFloor();
	bool isFloor();
	void convertToStairs( int mapIndex );
	bool isStair();
	void convertToDoor();
	bool isDoor();
	bool open();
	bool close();
	virtual void hitEffect( int force ) override;
	bool addToContents( MapObject * );
	bool addToContents( Item * );
	bool addToContents( Monster * );
	bool removeFromContents( MapObject * );
	bool removeFromContents( Item * );
	bool removeFromContents( Monster * );


	std::vector< MapObject * > contents;
	std::vector< Item * > itemContents;
	std::vector< Monster * > monsterContents;
	bool passable;
	bool visible;
	bool seen_;
	int stairTo;
protected:
	Tile();
	void setDrawState();

	bool open_;
	enum
	{
		state_floor,
		state_wall,
		state_stair,
		state_door
	} state_;
	unsigned int lastColor_;
	char lastSymbol_;
};

#endif